#pragma once
#include "Character.h"
#include "Monster.h"
#include <vector>
#include"Enum.h"
#include"Warrior.h"
#include "FileManager.h"
extern std::vector<Character*> g_characterTemplates;
class GameManager {
private:
    Character* player;
    std::vector<Monster> monsters;
    int currentMonsterIndex;

    // 装备库和技能库
    std::vector<Equipment> equipmentLibrary;
    std::vector<Skill> skillLibrary;
    std::vector<Monster> monsterLibrary;

    std::vector<User> userList;
    User currentUser;
    bool isLoggedIn = false;

    // 私有构造函数（单例模式）
    GameManager(Character* player = nullptr);
    ~GameManager();
public:
    // 删除拷贝构造函数和赋值操作符
    GameManager(const GameManager&) = delete;
    GameManager& operator=(const GameManager&) = delete;

    // 获取单例实例
    static GameManager& getInstance(Character* player = nullptr) {
        static GameManager instance(player);
        return instance;
    }
    Difficulty currentDifficulty;
    void initializeLibraries();
    void startGame();
    void battleTurn();
    void generateMonster();
    Equipment getRandomEquipment(Difficulty difficulty);
    Skill getRandomSkill(Difficulty difficulty);
    
    Monster getRandomMonster(Difficulty difficulty);

    // 角色模板初始化与选择
    void initializeCharacterTemplates();
    Character* selectCharacter();


    void saveGame(const std::string& slot = "autosave");
    bool loadGame(const std::string& slot = "autosave");

    // 添加退出方法
    void exitGame();

    // 添加菜单显示方法
    void showMainMenu();
    void manageLibraries();
    void manageEquipment();
    void manageSkills();
    void manageMonsters();
    void manageCharacters();

    bool login();
};

